/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('es-serverless', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CancelSpecReviewTaskResponseBody = {
  requestId?: string(name='requestId', example='1B64F3E0-25D5-5043-B5C8-4FF22BB12CCD'),
  result?: boolean(name='result', example='true'),
}

model CancelSpecReviewTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelSpecReviewTaskResponseBody(name='body'),
}

/**
 * @summary 撤销规格审批
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelSpecReviewTaskResponse
 */
async function cancelSpecReviewTaskWithOptions(appName: string, taskId: string, headers: map[string]string, runtime: $RuntimeOptions): CancelSpecReviewTaskResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'CancelSpecReviewTask',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/spec-review-tasks/${$URL.percentEncode(taskId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 撤销规格审批
 *
 * @return CancelSpecReviewTaskResponse
 */
async function cancelSpecReviewTask(appName: string, taskId: string): CancelSpecReviewTaskResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return cancelSpecReviewTaskWithOptions(appName, taskId, headers, runtime);
}

model CreateAppRequest {
  appName?: string(name='appName', description='应用名

This parameter is required.'),
  authentication?: {
    basicAuth?: [ 
      {
        password?: string(name='password'),
        username?: string(name='username'),
      }
    ](name='basicAuth'),
  }(name='authentication', description='This parameter is required.'),
  chargeType?: string(name='chargeType', description='This parameter is required.'),
  description?: string(name='description', description='应用备注'),
  network?: [ 
    {
      domain?: string(name='domain'),
      enabled?: boolean(name='enabled'),
      port?: int32(name='port'),
      type?: string(name='type'),
      whiteIpGroup?: [ 
        {
          groupName?: string(name='groupName'),
          ips?: [ string ](name='ips'),
        }
      ](name='whiteIpGroup'),
    }
  ](name='network'),
  privateNetwork?: [ 
    {
      enabled?: boolean(name='enabled'),
      pvlEndpointId?: string(name='pvlEndpointId'),
      type?: string(name='type'),
      vpcId?: string(name='vpcId'),
      whiteIpGroup?: [ 
        {
          groupName?: string(name='groupName'),
          ips?: [ string ](name='ips'),
        }
      ](name='whiteIpGroup'),
    }
  ](name='privateNetwork'),
  quotaInfo?: {
    appType?: string(name='appType'),
    cu?: int32(name='cu'),
    storage?: int32(name='storage'),
  }(name='quotaInfo'),
  regionId?: string(name='regionId'),
  scenario?: string(name='scenario'),
  tags?: [ 
    {
      key?: string(name='key'),
      value?: string(name='value'),
    }
  ](name='tags'),
  version?: string(name='version'),
  clientToken?: string(name='clientToken'),
  dryRun?: boolean(name='dryRun'),
}

model CreateAppResponseBody = {
  requestId?: string(name='requestId', example='2C5DAA30-****-5181-9B87-9D6181016197'),
  result?: {
    appId?: string(name='appId'),
    instaneId?: string(name='instaneId', example='es-serverless-cn-xxx'),
  }(name='result'),
}

model CreateAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAppResponseBody(name='body'),
}

/**
 * @summary 创建Serverless应用
 *
 * @param request CreateAppRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAppResponse
 */
async function createAppWithOptions(request: CreateAppRequest, headers: map[string]string, runtime: $RuntimeOptions): CreateAppResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.clientToken)) {
    query['clientToken'] = request.clientToken;
  }
  if (!$isNull(request.dryRun)) {
    query['dryRun'] = request.dryRun;
  }

  var body : map[string]any = {};
  if (!$isNull(request.appName)) {
    body['appName'] = request.appName;
  }
  if (!$isNull(request.authentication)) {
    body['authentication'] = request.authentication;
  }
  if (!$isNull(request.chargeType)) {
    body['chargeType'] = request.chargeType;
  }
  if (!$isNull(request.description)) {
    body['description'] = request.description;
  }
  if (!$isNull(request.network)) {
    body['network'] = request.network;
  }
  if (!$isNull(request.privateNetwork)) {
    body['privateNetwork'] = request.privateNetwork;
  }
  if (!$isNull(request.quotaInfo)) {
    body['quotaInfo'] = request.quotaInfo;
  }
  if (!$isNull(request.regionId)) {
    body['regionId'] = request.regionId;
  }
  if (!$isNull(request.scenario)) {
    body['scenario'] = request.scenario;
  }
  if (!$isNull(request.tags)) {
    body['tags'] = request.tags;
  }
  if (!$isNull(request.version)) {
    body['version'] = request.version;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateApp',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建Serverless应用
 *
 * @param request CreateAppRequest
 * @return CreateAppResponse
 */
async function createApp(request: CreateAppRequest): CreateAppResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return createAppWithOptions(request, headers, runtime);
}

model CreateEndpointRequest {
  endpointZones?: [ 
    {
      vswitchId?: string(name='vswitchId', example='vsw-uf6qmfkqdcw*****'),
      zoneId?: string(name='zoneId', example='cn-hangzhou-h'),
    }
  ](name='endpointZones', description='This parameter is required.'),
  name?: string(name='name', example='testendpoint'),
  vpcId?: string(name='vpcId', description='This parameter is required.', example='vpc-uf664nyle5khp5***'),
  type?: string(name='type', example='VPC'),
}

model CreateEndpointResponseBody = {
  requestId?: string(name='requestId', description='Id of the request', example='2C5DAA30-****-5181-9B87-9D6181016197'),
  result?: {
    endpointId?: string(name='endpointId', example='essep-abd***dks'),
  }(name='result'),
}

model CreateEndpointResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateEndpointResponseBody(name='body'),
}

/**
 * @summary 创建端点
 *
 * @param request CreateEndpointRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateEndpointResponse
 */
async function createEndpointWithOptions(request: CreateEndpointRequest, headers: map[string]string, runtime: $RuntimeOptions): CreateEndpointResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.type)) {
    query['type'] = request.type;
  }

  var body : map[string]any = {};
  if (!$isNull(request.endpointZones)) {
    body['endpointZones'] = request.endpointZones;
  }
  if (!$isNull(request.name)) {
    body['name'] = request.name;
  }
  if (!$isNull(request.vpcId)) {
    body['vpcId'] = request.vpcId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateEndpoint',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/endpoints`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建端点
 *
 * @param request CreateEndpointRequest
 * @return CreateEndpointResponse
 */
async function createEndpoint(request: CreateEndpointRequest): CreateEndpointResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return createEndpointWithOptions(request, headers, runtime);
}

model CreateSnapshotRequest {
  indices?: string(name='indices', description='This parameter is required.', example='product_info'),
  snapshot?: string(name='snapshot', description='This parameter is required.', example='qingning'),
  dryRun?: boolean(name='dryRun', example='false'),
}

model CreateSnapshotResponseBody = {
  requestId?: string(name='requestId', example='03761BE5-D12F-55B4-9C93-0255C11DE44A'),
  result?: boolean(name='result', example='true'),
}

model CreateSnapshotResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSnapshotResponseBody(name='body'),
}

/**
 * @summary 创建快照
 *
 * @param request CreateSnapshotRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSnapshotResponse
 */
async function createSnapshotWithOptions(appName: string, repository: string, request: CreateSnapshotRequest, headers: map[string]string, runtime: $RuntimeOptions): CreateSnapshotResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.dryRun)) {
    query['dryRun'] = request.dryRun;
  }

  var body : map[string]any = {};
  if (!$isNull(request.indices)) {
    body['indices'] = request.indices;
  }
  if (!$isNull(request.snapshot)) {
    body['snapshot'] = request.snapshot;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateSnapshot',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/snapshot-repositories/${$URL.percentEncode(repository)}/snapshots`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建快照
 *
 * @param request CreateSnapshotRequest
 * @return CreateSnapshotResponse
 */
async function createSnapshot(appName: string, repository: string, request: CreateSnapshotRequest): CreateSnapshotResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return createSnapshotWithOptions(appName, repository, request, headers, runtime);
}

model DeleteAppResponseBody = {
  requestId?: string(name='requestId', example='2C5DAA30-****-5181-9B87-9D6181016197'),
  result?: {
    instanceId?: string(name='instanceId'),
  }(name='result'),
}

model DeleteAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAppResponseBody(name='body'),
}

/**
 * @summary 删除Serverless应用。
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAppResponse
 */
async function deleteAppWithOptions(appName: string, headers: map[string]string, runtime: $RuntimeOptions): DeleteAppResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteApp',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 删除Serverless应用。
 *
 * @return DeleteAppResponse
 */
async function deleteApp(appName: string): DeleteAppResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteAppWithOptions(appName, headers, runtime);
}

model DeleteDictRequest {
  name?: string(name='name', description='This parameter is required.', example='a.dic'),
  type?: string(name='type', description='This parameter is required.', example='MAIN'),
}

model DeleteDictResponseBody = {
  requestId?: string(name='requestId', example='2BF6B57E-5AAD-5389-80CD-E200BBF91FF9'),
  result?: boolean(name='result', example='true'),
}

model DeleteDictResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDictResponseBody(name='body'),
}

/**
 * @summary 删除词典
 *
 * @param request DeleteDictRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDictResponse
 */
async function deleteDictWithOptions(appName: string, request: DeleteDictRequest, headers: map[string]string, runtime: $RuntimeOptions): DeleteDictResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.name)) {
    body['name'] = request.name;
  }
  if (!$isNull(request.type)) {
    body['type'] = request.type;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteDict',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/dicts/actions/remove`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 删除词典
 *
 * @param request DeleteDictRequest
 * @return DeleteDictResponse
 */
async function deleteDict(appName: string, request: DeleteDictRequest): DeleteDictResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteDictWithOptions(appName, request, headers, runtime);
}

model DeleteEndpointResponseBody = {
  requestId?: string(name='requestId', example='1305A3E0-A291-54BA-A3B2-7D1C12EC4112'),
  result?: boolean(name='result', example='true'),
}

model DeleteEndpointResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteEndpointResponseBody(name='body'),
}

/**
 * @summary 删除端点
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteEndpointResponse
 */
async function deleteEndpointWithOptions(endpointId: string, headers: map[string]string, runtime: $RuntimeOptions): DeleteEndpointResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteEndpoint',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/endpoints/${$URL.percentEncode(endpointId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 删除端点
 *
 * @return DeleteEndpointResponse
 */
async function deleteEndpoint(endpointId: string): DeleteEndpointResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteEndpointWithOptions(endpointId, headers, runtime);
}

model DeleteSnapshotResponseBody = {
  requestId?: string(name='requestId', example='16484F36-A2A3-5A05-B242-0BF2BF6AA326'),
  result?: boolean(name='result', example='true'),
}

model DeleteSnapshotResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSnapshotResponseBody(name='body'),
}

/**
 * @summary 删除快照
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSnapshotResponse
 */
async function deleteSnapshotWithOptions(appName: string, repository: string, snapshot: string, headers: map[string]string, runtime: $RuntimeOptions): DeleteSnapshotResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteSnapshot',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/snapshot-repositories/${$URL.percentEncode(repository)}/snapshots/${$URL.percentEncode(snapshot)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 删除快照
 *
 * @return DeleteSnapshotResponse
 */
async function deleteSnapshot(appName: string, repository: string, snapshot: string): DeleteSnapshotResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteSnapshotWithOptions(appName, repository, snapshot, headers, runtime);
}

model GetAppRequest {
  detailed?: boolean(name='detailed', example='false'),
}

model GetAppResponseBody = {
  requestId?: string(name='requestId', example='2C5DAA30-****-5181-9B87-9D6181016197'),
  result?: {
    appId?: string(name='appId', example='test-app-abc'),
    appName?: string(name='appName', example='es-severless-test-app'),
    appType?: string(name='appType'),
    chargeType?: string(name='chargeType'),
    createTime?: string(name='createTime', example='2022-08-15T11:20:52.370Z'),
    description?: string(name='description'),
    instanceId?: string(name='instanceId'),
    modifiedTime?: string(name='modifiedTime', example='2022-08-15T11:21:50.000Z'),
    network?: [ 
      {
        domain?: string(name='domain'),
        enabled?: boolean(name='enabled'),
        port?: int32(name='port'),
        type?: string(name='type'),
        whiteIpGroup?: [ 
          {
            groupName?: string(name='groupName'),
            ips?: [ string ](name='ips'),
          }
        ](name='whiteIpGroup'),
      }
    ](name='network'),
    ownerId?: string(name='ownerId', example='*******7595'),
    privateNetwork?: [ 
      {
        domain?: string(name='domain'),
        enabled?: boolean(name='enabled'),
        port?: int32(name='port'),
        pvlEndpointId?: string(name='pvlEndpointId'),
        type?: string(name='type'),
        vpcId?: string(name='vpcId'),
        whiteIpGroup?: [ 
          {
            groupName?: string(name='groupName'),
            ips?: [ string ](name='ips'),
          }
        ](name='whiteIpGroup'),
      }
    ](name='privateNetwork'),
    regionId?: string(name='regionId', example='cn-hangzhou'),
    scenario?: string(name='scenario'),
    status?: string(name='status', example='ACTIVE'),
    tags?: [ 
      {
        key?: string(name='key'),
        value?: string(name='value'),
      }
    ](name='tags'),
    version?: string(name='version', example='7.10'),
  }(name='result'),
}

model GetAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAppResponseBody(name='body'),
}

/**
 * @summary 获取Serverless应用详情
 *
 * @param request GetAppRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAppResponse
 */
async function getAppWithOptions(appName: string, request: GetAppRequest, headers: map[string]string, runtime: $RuntimeOptions): GetAppResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.detailed)) {
    query['detailed'] = request.detailed;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetApp',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取Serverless应用详情
 *
 * @param request GetAppRequest
 * @return GetAppResponse
 */
async function getApp(appName: string, request: GetAppRequest): GetAppResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getAppWithOptions(appName, request, headers, runtime);
}

model GetAppQuotaResponseBody = {
  requestId?: string(name='requestId', example='2C5DAA30-****-5181-9B87-9D6181016197'),
  result?: {
    limiterInfo?: {
      limiters?: [ 
        {
          immutable?: boolean(name='immutable', example='true'),
          maxValue?: long(name='maxValue', example='10'),
          minValue?: long(name='minValue', example='1'),
          type?: string(name='type', example='INDEX_NUMBER_OF_SHARDS'),
        }
      ](name='limiters'),
    }(name='limiterInfo'),
    quotaInfo?: map[string]any(name='quotaInfo'),
  }(name='result'),
}

model GetAppQuotaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAppQuotaResponseBody(name='body'),
}

/**
 * @summary 获取Serverless应用配额详情
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAppQuotaResponse
 */
async function getAppQuotaWithOptions(appName: string, headers: map[string]string, runtime: $RuntimeOptions): GetAppQuotaResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'GetAppQuota',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/quota`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取Serverless应用配额详情
 *
 * @return GetAppQuotaResponse
 */
async function getAppQuota(appName: string): GetAppQuotaResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getAppQuotaWithOptions(appName, headers, runtime);
}

model GetMonitorDataRequest {
  body?: string(name='body', example='{"start":1689245180581,"end":1689246950582,"queries":[{"metric":"aliyunes.elasticsearch.index.docs.count","aggregator":"sum","downsample":"avg","tags":{"resource":"{appName}"},"filters":[],"granularity":"auto"}]}'),
}

model GetMonitorDataResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='internal server error'),
  requestId?: string(name='requestId', example='2C5DAA30-****-5181-9B87-9D6181016197'),
  result?: [ 
    {
      dps?: map[string]any(name='dps', example='{
    "1689480600":28676235.104761902
}'),
      integrity?: float(name='integrity', example='1'),
      messageWatermark?: long(name='messageWatermark', example='1689566839447'),
      metric?: string(name='metric', example='elasticsearch-server.logic_cpu.cpu'),
      summary?: float(name='summary', example='172455913.18935508'),
      tags?: map[string]any(name='tags', example='{
                "indexName":"test"
            }'),
    }
  ](name='result'),
  success?: boolean(name='success', example='true'),
}

model GetMonitorDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMonitorDataResponseBody(name='body'),
}

/**
 * @summary 获取监控数据
 *
 * @param request GetMonitorDataRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMonitorDataResponse
 */
async function getMonitorDataWithOptions(request: GetMonitorDataRequest, headers: map[string]string, runtime: $RuntimeOptions): GetMonitorDataResponse {
  request.validate();
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = request.body,
  };
  var params = new OpenApiUtil.Params{
    action = 'GetMonitorData',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/emon/metrics/query`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取监控数据
 *
 * @param request GetMonitorDataRequest
 * @return GetMonitorDataResponse
 */
async function getMonitorData(request: GetMonitorDataRequest): GetMonitorDataResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getMonitorDataWithOptions(request, headers, runtime);
}

model GetSnapshotSettingResponseBody = {
  requestId?: string(name='requestId', example='7B6CE6E1-5BA0-56DA-BFFD-8D90692F1EFC'),
  result?: {
    enable?: boolean(name='enable', example='true'),
    quartzRegex?: string(name='quartzRegex', example='0 0 01 ? * * *'),
  }(name='result'),
}

model GetSnapshotSettingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSnapshotSettingResponseBody(name='body'),
}

/**
 * @summary 获取自动备份配置
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSnapshotSettingResponse
 */
async function getSnapshotSettingWithOptions(appName: string, headers: map[string]string, runtime: $RuntimeOptions): GetSnapshotSettingResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'GetSnapshotSetting',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/auto-snapshot-setting`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取自动备份配置
 *
 * @return GetSnapshotSettingResponse
 */
async function getSnapshotSetting(appName: string): GetSnapshotSettingResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getSnapshotSettingWithOptions(appName, headers, runtime);
}

model GetSpecReviewTaskResponseBody = {
  requestId?: string(name='requestId', example='E310AC54-957A-5FD5-B85B-E972B2BDA8DE'),
  result?: {
    id?: string(name='Id', description='代表资源一级ID的资源属性字段', example='339'),
    appName?: string(name='appName', example='test'),
    applyLimiter?: map[string]any(name='applyLimiter', example='{
               "limiters": [
                    {
                         "type": "INDEX_QUOTA",
                         "maxValue": 500,
                         "immutable": false
                    }
               ]
          }'),
    applyQuota?: map[string]any(name='applyQuota', example='{
               "appType": "TRIAL",
               "cu": 4,
               "storage": 100
          }'),
    applyReason?: string(name='applyReason'),
    effectiveLimiter?: map[string]any(name='effectiveLimiter', example='{
               "limiters": [
                    {
                         "type": "INDEX_QUOTA",
                         "maxValue": 500,
                         "immutable": false
                    }
               ]
          }'),
    effectiveQuota?: map[string]any(name='effectiveQuota', example='{
               "appType": "TRIAL",
               "cu": 4,
               "storage": 100
          }'),
    gmtCreate?: string(name='gmtCreate', example='2024-05-30T06:28:07.000Z'),
    gmtModified?: string(name='gmtModified', example='2024-05-30T06:28:07.000Z'),
    oldLimiter?: map[string]any(name='oldLimiter', example='{
               "limiters": [
                    {
                         "type": "INDEX_QUOTA",
                         "maxValue": 500,
                         "immutable": false
                    }
               ]
          }'),
    oldQuota?: map[string]any(name='oldQuota', example='{
               "appType": "TRIAL",
               "cu": 2,
               "storage": 1
          }'),
    source?: string(name='source', example='USER'),
    status?: string(name='status', example='Pending'),
    type?: string(name='type', example='QUOTA'),
  }(name='result'),
}

model GetSpecReviewTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSpecReviewTaskResponseBody(name='body'),
}

/**
 * @summary 获取配额审批详情
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSpecReviewTaskResponse
 */
async function getSpecReviewTaskWithOptions(appName: string, taskId: string, headers: map[string]string, runtime: $RuntimeOptions): GetSpecReviewTaskResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'GetSpecReviewTask',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/spec-review-tasks/${$URL.percentEncode(taskId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取配额审批详情
 *
 * @return GetSpecReviewTaskResponse
 */
async function getSpecReviewTask(appName: string, taskId: string): GetSpecReviewTaskResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return getSpecReviewTaskWithOptions(appName, taskId, headers, runtime);
}

model ListAppsRequest {
  appName?: string(name='appName', example='es-severless-test-app'),
  createTime?: string(name='createTime', example='2023-08-29T02:37:22Z'),
  description?: string(name='description', example='metrics-logs-online'),
  orderType?: string(name='orderType', example='desc'),
  pageNumber?: int32(name='pageNumber', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
  status?: string(name='status', example='ACTIVE'),
  tags?: string(name='tags'),
}

model ListAppsResponseBody = {
  requestId?: string(name='requestId', example='2C5DAA30-****-5181-9B87-9D6181016197'),
  result?: [ 
    {
      appId?: string(name='appId', example='test-abc'),
      appName?: string(name='appName', description='代表资源名称的资源属性字段', example='es-severless-test-app'),
      appType?: string(name='appType'),
      createTime?: string(name='createTime', description='代表创建时间的资源属性字段', example='2022-12-27T07:09:11.000Z'),
      description?: string(name='description', description='应用备注'),
      instanceId?: string(name='instanceId'),
      modifiedTime?: string(name='modifiedTime', example='2022-12-27T07:09:11.000Z'),
      ownerId?: string(name='ownerId', description='OwnerID账号ID', example='*********7595'),
      regionId?: string(name='regionId', description='代表region的资源属性字段', example='cn-hangzhou'),
      status?: string(name='status', description='代表资源状态的资源属性字段', example='ACTIVE'),
      version?: string(name='version', example='7.10'),
    }
  ](name='result'),
  totalCount?: int32(name='totalCount', description='This parameter is required.', example='4'),
}

model ListAppsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAppsResponseBody(name='body'),
}

/**
 * @summary 查看Serverless应用列表
 *
 * @param request ListAppsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAppsResponse
 */
async function listAppsWithOptions(request: ListAppsRequest, headers: map[string]string, runtime: $RuntimeOptions): ListAppsResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.appName)) {
    query['appName'] = request.appName;
  }
  if (!$isNull(request.createTime)) {
    query['createTime'] = request.createTime;
  }
  if (!$isNull(request.description)) {
    query['description'] = request.description;
  }
  if (!$isNull(request.orderType)) {
    query['orderType'] = request.orderType;
  }
  if (!$isNull(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!$isNull(request.status)) {
    query['status'] = request.status;
  }
  if (!$isNull(request.tags)) {
    query['tags'] = request.tags;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListApps',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查看Serverless应用列表
 *
 * @param request ListAppsRequest
 * @return ListAppsResponse
 */
async function listApps(request: ListAppsRequest): ListAppsResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return listAppsWithOptions(request, headers, runtime);
}

model ListDictsRequest {
  pageNumber?: int32(name='pageNumber', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
}

model ListDictsResponseBody = {
  requestId?: string(name='requestId', example='E92BCBB9-3CFE-58DD-8D8C-56DF46AB3BF3'),
  result?: [ 
    {
      downloadUrl?: string(name='downloadUrl', example='http://es-serverless-****.oss-cn-hangzhou.aliyuncs.com/app/es7**190/0/config/analysis-ik/stopword.dic?Expires=1705923089&OSSAccessKeyId=STS.NV18q****UkVp6LNj&Signat'),
      name?: string(name='name', example='a.dic'),
      sourceType?: string(name='sourceType', example='OSS'),
      type?: string(name='type', example='MAIN'),
    }
  ](name='result'),
  totalCount?: int32(name='totalCount', example='1'),
}

model ListDictsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDictsResponseBody(name='body'),
}

/**
 * @summary 获取词典列表
 *
 * @param request ListDictsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDictsResponse
 */
async function listDictsWithOptions(appName: string, request: ListDictsRequest, headers: map[string]string, runtime: $RuntimeOptions): ListDictsResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListDicts',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/dicts`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取词典列表
 *
 * @param request ListDictsRequest
 * @return ListDictsResponse
 */
async function listDicts(appName: string, request: ListDictsRequest): ListDictsResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return listDictsWithOptions(appName, request, headers, runtime);
}

model ListEndpointsRequest {
  pageNumber?: int32(name='pageNumber', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
  resourceId?: string(name='resourceId', example='ep-bp1id41dd116e52e****'),
  type?: string(name='type', description='This parameter is required.', example='VPC'),
  vpcId?: string(name='vpcId', example='vpc-bp1212sb7cj2j4e6x****'),
}

model ListEndpointsResponseBody = {
  requestId?: string(name='requestId', example='D6030CE6-9FEB-5B2F-84AC-3ADE3CBA89E5'),
  result?: [ 
    {
      connectionStatus?: string(name='connectionStatus', example='Pending'),
      created?: int32(name='created', example='1701259721'),
      domain?: string(name='domain', example='ep-bp1i522d****a3.epsrv-bp1f****gei.cn-hangzhou.privatelink.aliyuncs.com'),
      endpointId?: string(name='endpointId', example='essep-2f46b743f60****'),
      endpointZones?: [ 
        {
          vSwitchId?: string(name='vSwitchId', example='vsw-bp194pz9iez****'),
          zoneId?: string(name='zoneId', example='cn-hangzhou-k'),
        }
      ](name='endpointZones'),
      name?: string(name='name', example='test'),
      resourceId?: string(name='resourceId', example='ep-bp1id41dd116e52e****'),
      securityGroupIds?: [ string ](name='securityGroupIds'),
      status?: string(name='status', example='Active'),
      type?: string(name='type', example='VPC'),
      updated?: int32(name='updated', example='1701259721'),
      vpcId?: string(name='vpcId', example='vpc-uf6gykvwcirp886ef****'),
    }
  ](name='result'),
  totalCount?: int32(name='totalCount', example='10'),
}

model ListEndpointsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListEndpointsResponseBody(name='body'),
}

/**
 * @summary 获取端点信息列表
 *
 * @param request ListEndpointsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListEndpointsResponse
 */
async function listEndpointsWithOptions(request: ListEndpointsRequest, headers: map[string]string, runtime: $RuntimeOptions): ListEndpointsResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!$isNull(request.resourceId)) {
    query['resourceId'] = request.resourceId;
  }
  if (!$isNull(request.type)) {
    query['type'] = request.type;
  }
  if (!$isNull(request.vpcId)) {
    query['vpcId'] = request.vpcId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListEndpoints',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/endpoints`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取端点信息列表
 *
 * @param request ListEndpointsRequest
 * @return ListEndpointsResponse
 */
async function listEndpoints(request: ListEndpointsRequest): ListEndpointsResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return listEndpointsWithOptions(request, headers, runtime);
}

model ListIndicesResponseBody = {
  requestId?: string(name='requestId', description='Id of the request', example='8C85CCB3-C0C9-521C-B599-F903E14A8793'),
  result?: [ any ](name='result'),
}

model ListIndicesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListIndicesResponseBody(name='body'),
}

/**
 * @summary 查看索引列表
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListIndicesResponse
 */
async function listIndicesWithOptions(appName: string, headers: map[string]string, runtime: $RuntimeOptions): ListIndicesResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'ListIndices',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/indices`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查看索引列表
 *
 * @return ListIndicesResponse
 */
async function listIndices(appName: string): ListIndicesResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return listIndicesWithOptions(appName, headers, runtime);
}

model ListSnapshotRepositoriesResponseBody = {
  requestId?: string(name='requestId', example='56E0591D-7D62-56A2-993E-952FB2026C69'),
  result?: [  map[string]any ](name='result'),
}

model ListSnapshotRepositoriesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSnapshotRepositoriesResponseBody(name='body'),
}

/**
 * @summary 获取快照仓库列表
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSnapshotRepositoriesResponse
 */
async function listSnapshotRepositoriesWithOptions(appName: string, headers: map[string]string, runtime: $RuntimeOptions): ListSnapshotRepositoriesResponse {
  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApiUtil.Params{
    action = 'ListSnapshotRepositories',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/snapshot-repositories`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取快照仓库列表
 *
 * @return ListSnapshotRepositoriesResponse
 */
async function listSnapshotRepositories(appName: string): ListSnapshotRepositoriesResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return listSnapshotRepositoriesWithOptions(appName, headers, runtime);
}

model ListSnapshotsRequest {
  pageNumber?: int32(name='pageNumber', example='1'),
  pageSize?: int32(name='pageSize', example='10'),
  repository?: string(name='repository', example='aliyun_auto_snapshot'),
  snapshot?: string(name='snapshot', example='qingning'),
}

model ListSnapshotsResponseBody = {
  nextToken?: string(name='nextToken', example='ODgyObrnP3'),
  requestId?: string(name='requestId', example='22E9EE78-F567-550A-8F7C-20E9CD3DE489'),
  result?: [  map[string]any ](name='result'),
  totalCount?: int32(name='totalCount', example='1'),
}

model ListSnapshotsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSnapshotsResponseBody(name='body'),
}

/**
 * @summary 获取仓库的快照列表
 *
 * @param request ListSnapshotsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSnapshotsResponse
 */
async function listSnapshotsWithOptions(appName: string, request: ListSnapshotsRequest, headers: map[string]string, runtime: $RuntimeOptions): ListSnapshotsResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!$isNull(request.repository)) {
    query['repository'] = request.repository;
  }
  if (!$isNull(request.snapshot)) {
    query['snapshot'] = request.snapshot;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListSnapshots',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/snapshots`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取仓库的快照列表
 *
 * @param request ListSnapshotsRequest
 * @return ListSnapshotsResponse
 */
async function listSnapshots(appName: string, request: ListSnapshotsRequest): ListSnapshotsResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return listSnapshotsWithOptions(appName, request, headers, runtime);
}

model ListSpecReviewTasksRequest {
  page?: int32(name='page', example='1'),
  pageNumber?: int32(name='pageNumber'),
  pageSize?: int32(name='pageSize'),
  size?: int32(name='size', example='10'),
  status?: string(name='status'),
  type?: string(name='type', example='QUOTA'),
}

model ListSpecReviewTasksResponseBody = {
  requestId?: string(name='requestId', description='Id of the request', example='55F7B3FE-05D8-5F0F-BD55-A18967D447DC'),
  result?: [ 
    {
      id?: string(name='Id', description='代表资源一级ID的资源属性字段', example='339'),
      appName?: string(name='appName', example='test'),
      applyReason?: string(name='applyReason'),
      gmtCreate?: string(name='gmtCreate', example='2024-05-27T10:13:22.000Z'),
      source?: string(name='source', example='USER'),
      status?: string(name='status', example='Pending'),
      type?: string(name='type', example='QUOTA'),
    }
  ](name='result'),
  totalCount?: int32(name='totalCount', example='1'),
}

model ListSpecReviewTasksResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSpecReviewTasksResponseBody(name='body'),
}

/**
 * @summary 获取规格审批列表
 *
 * @param request ListSpecReviewTasksRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSpecReviewTasksResponse
 */
async function listSpecReviewTasksWithOptions(appName: string, request: ListSpecReviewTasksRequest, headers: map[string]string, runtime: $RuntimeOptions): ListSpecReviewTasksResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.page)) {
    query['page'] = request.page;
  }
  if (!$isNull(request.pageNumber)) {
    query['pageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!$isNull(request.size)) {
    query['size'] = request.size;
  }
  if (!$isNull(request.status)) {
    query['status'] = request.status;
  }
  if (!$isNull(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListSpecReviewTasks',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/spec-review-tasks`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取规格审批列表
 *
 * @param request ListSpecReviewTasksRequest
 * @return ListSpecReviewTasksResponse
 */
async function listSpecReviewTasks(appName: string, request: ListSpecReviewTasksRequest): ListSpecReviewTasksResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return listSpecReviewTasksWithOptions(appName, request, headers, runtime);
}

model UpdateAppRequest {
  applyReason?: string(name='applyReason'),
  authentication?: {
    basicAuth?: [ 
      {
        password?: string(name='password'),
        username?: string(name='username'),
      }
    ](name='basicAuth'),
  }(name='authentication'),
  contactInfo?: string(name='contactInfo'),
  description?: string(name='description', description='应用备注'),
  limiterInfo?: {
    limiters?: [ 
      {
        maxValue?: int32(name='maxValue'),
        minValue?: int32(name='minValue'),
        type?: string(name='type'),
        values?: [ string ](name='values'),
      }
    ](name='limiters'),
  }(name='limiterInfo'),
  network?: [ 
    {
      domain?: string(name='domain'),
      enabled?: boolean(name='enabled'),
      port?: int32(name='port'),
      type?: string(name='type'),
      whiteIpGroup?: [ 
        {
          groupName?: string(name='groupName'),
          ips?: [ string ](name='ips'),
        }
      ](name='whiteIpGroup'),
    }
  ](name='network'),
  privateNetwork?: [ 
    {
      enabled?: boolean(name='enabled'),
      pvlEndpointId?: string(name='pvlEndpointId'),
      type?: string(name='type'),
      vpcId?: string(name='vpcId'),
      whiteIpGroup?: [ 
        {
          groupName?: string(name='groupName'),
          ips?: [ string ](name='ips'),
        }
      ](name='whiteIpGroup'),
    }
  ](name='privateNetwork'),
}

model UpdateAppResponseBody = {
  requestId?: string(name='requestId', example='2C5DAA30-****-5181-9B87-9D6181016197'),
  result?: {
    instanceId?: string(name='instanceId'),
  }(name='result'),
}

model UpdateAppResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAppResponseBody(name='body'),
}

/**
 * @summary 编辑Serverless应用
 *
 * @param request UpdateAppRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateAppResponse
 */
async function updateAppWithOptions(appName: string, request: UpdateAppRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdateAppResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.applyReason)) {
    body['applyReason'] = request.applyReason;
  }
  if (!$isNull(request.authentication)) {
    body['authentication'] = request.authentication;
  }
  if (!$isNull(request.contactInfo)) {
    body['contactInfo'] = request.contactInfo;
  }
  if (!$isNull(request.description)) {
    body['description'] = request.description;
  }
  if (!$isNull(request.limiterInfo)) {
    body['limiterInfo'] = request.limiterInfo;
  }
  if (!$isNull(request.network)) {
    body['network'] = request.network;
  }
  if (!$isNull(request.privateNetwork)) {
    body['privateNetwork'] = request.privateNetwork;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateApp',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}`,
    method = 'PATCH',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 编辑Serverless应用
 *
 * @param request UpdateAppRequest
 * @return UpdateAppResponse
 */
async function updateApp(appName: string, request: UpdateAppRequest): UpdateAppResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return updateAppWithOptions(appName, request, headers, runtime);
}

model UpdateDictRequest {
  allowCover?: boolean(name='allowCover', example='true'),
  files?: [ 
    {
      name?: string(name='name', example='dic_0.dic'),
      ossObject?: {
        bucketName?: string(name='bucketName', example='bucket1'),
        key?: string(name='key', example='oss/dic_0.dic'),
      }(name='ossObject'),
    }
  ](name='files', description='This parameter is required.'),
  sourceType?: string(name='sourceType', example='OSS'),
  type?: string(name='type', example='MAIN'),
  dryRun?: boolean(name='dryRun', example='true'),
}

model UpdateDictResponseBody = {
  requestId?: string(name='requestId', example='12797BCC-E0B5-5A47-B4B9-A14DDF0B0200'),
  result?: boolean(name='result', example='true'),
}

model UpdateDictResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateDictResponseBody(name='body'),
}

/**
 * @summary 创建或更新词典
 *
 * @param request UpdateDictRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateDictResponse
 */
async function updateDictWithOptions(appName: string, request: UpdateDictRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdateDictResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.allowCover)) {
    query['allowCover'] = request.allowCover;
  }
  if (!$isNull(request.dryRun)) {
    query['dryRun'] = request.dryRun;
  }

  var body : map[string]any = {};
  if (!$isNull(request.files)) {
    body['files'] = request.files;
  }
  if (!$isNull(request.sourceType)) {
    body['sourceType'] = request.sourceType;
  }
  if (!$isNull(request.type)) {
    body['type'] = request.type;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateDict',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/dicts`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 创建或更新词典
 *
 * @param request UpdateDictRequest
 * @return UpdateDictResponse
 */
async function updateDict(appName: string, request: UpdateDictRequest): UpdateDictResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return updateDictWithOptions(appName, request, headers, runtime);
}

model UpdateEndpointRequest {
  endpointZones?: [ 
    {
      vSwitchId?: string(name='vSwitchId', example='vsw-bp18r8uwnukv3rvi9****'),
      zoneId?: string(name='zoneId', example='cn-hangzhou-h'),
    }
  ](name='endpointZones', description='This parameter is required.'),
  name?: string(name='name', example='test'),
}

model UpdateEndpointResponseBody = {
  requestId?: string(name='requestId', example='FBAD8493-87FA-583E-8A4C-D487F2DE90FC'),
  result?: {
    endpointId?: string(name='endpointId', example='ep-bp1i98bcbb1540d0****'),
  }(name='result'),
}

model UpdateEndpointResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateEndpointResponseBody(name='body'),
}

/**
 * @summary 修改端点信息
 *
 * @param request UpdateEndpointRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateEndpointResponse
 */
async function updateEndpointWithOptions(endpointId: string, request: UpdateEndpointRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdateEndpointResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.endpointZones)) {
    body['endpointZones'] = request.endpointZones;
  }
  if (!$isNull(request.name)) {
    body['name'] = request.name;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateEndpoint',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/endpoints/${$URL.percentEncode(endpointId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 修改端点信息
 *
 * @param request UpdateEndpointRequest
 * @return UpdateEndpointResponse
 */
async function updateEndpoint(endpointId: string, request: UpdateEndpointRequest): UpdateEndpointResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return updateEndpointWithOptions(endpointId, request, headers, runtime);
}

model UpdateSnapshotSettingRequest {
  enable?: boolean(name='enable', description='This parameter is required.', example='true'),
  quartzRegex?: string(name='quartzRegex', description='This parameter is required.', example='0 0 01 ? * * *'),
}

model UpdateSnapshotSettingResponseBody = {
  requestId?: string(name='requestId', example='A7B03723-AA73-5A5F-B71C-270792614DD8'),
  result?: map[string]any(name='result', example='{
    "quartzRegex": "0 0 01 ? * * *",
    "enable": true
  }'),
}

model UpdateSnapshotSettingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateSnapshotSettingResponseBody(name='body'),
}

/**
 * @summary 修改自动备份配置
 *
 * @param request UpdateSnapshotSettingRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateSnapshotSettingResponse
 */
async function updateSnapshotSettingWithOptions(appName: string, request: UpdateSnapshotSettingRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdateSnapshotSettingResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.enable)) {
    body['enable'] = request.enable;
  }
  if (!$isNull(request.quartzRegex)) {
    body['quartzRegex'] = request.quartzRegex;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateSnapshotSetting',
    version = '2023-06-27',
    protocol = 'HTTPS',
    pathname = `/openapi/es-serverless/instances/${$URL.percentEncode(appName)}/auto-snapshot-setting`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 修改自动备份配置
 *
 * @param request UpdateSnapshotSettingRequest
 * @return UpdateSnapshotSettingResponse
 */
async function updateSnapshotSetting(appName: string, request: UpdateSnapshotSettingRequest): UpdateSnapshotSettingResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return updateSnapshotSettingWithOptions(appName, request, headers, runtime);
}

